import CommentSetUp from './comment-SetUp.html';
import _ from 'underscore';
import Util from '../../../common-component/util/util.js';
import Table from '../../../common-component/table/table.js';
import Address from '../../../common-component/address/address.js';
import API from '../../../api/Api.js';
import Dialog from '../../../common-component/dialog/dialog.js'
import ChoiceDialog from '../../../common-component/choice-dialog/choice-dialog.js';
import Pagination from '../../../common-component/pagination/pagination.js';
import Api from '../../../api/Api.js';
import ServiceCommon from '../../service-common/service-common.js';

import "../comment.scss";

export default function CompanyCityArea() {
    const FIRST_PAGE = 1, PAGE_SIZE = 10;
    $("#app-container").html( CommentSetUp() );

    var closeIcon=document.getElementById("closeIcon"),openIcon=document.getElementById("openIcon"),closeBlack=document.getElementById("closeBlack"),openBlack=document.getElementById("openBlack"),closeIconInput = $("#closeIconInput"),closeBlackInput = $("#closeBlackInput"),operType;
    closeBlack.onclick=function(){//是否发送邮件
        openBlack.className=(openBlack.className.indexOf("closeIc") > 0)?"openIcon openIc":"openIcon closeIc";
        closeBlack.className=(closeBlack.className.indexOf("closeOn") > 0)?"closeIcon openOn":"closeIcon closeOn";
        console.log(closeBlack.className)
        if(closeBlack.className.indexOf("openOn") > 0) {
            closeBlackInput[0].value = true;
        }else {
            closeBlackInput[0].value = false;
        }
    }
    closeIcon.onclick=function(){//留言是否需要提交用户信息
        openIcon.className=(openIcon.className.indexOf("closeIc") > 0)?"openIcon openIc":"openIcon closeIc";
        closeIcon.className=(closeIcon.className.indexOf("closeOn") > 0)?"closeIcon openOn":"closeIcon closeOn";
        if(closeIcon.className.indexOf("openOn") > 0) {
            closeIconInput[0].value = true;
            $("#stationNamesStars").html('*');
            $("#stationName").attr('data-easyform','');
        }else {
            closeIconInput[0].value = false;
            $("#stationNamesStars").html('');
            $("#stationName").attr('data-easyform','null;');
            $('#update_dot').easyform()
        }
    }

    var v = $('#query_form').easyform();
    v.success = function (ef){//验证成功
        _this.params = $(ef.form).serializeObject(_this.params);
        _this.querySearch(_this.params);
    }
    $('#resetBtn').on('click',function(){
        $('input[name=addressCode],input[name=companyCode]').val('');
        window.setTimeout(function(){
            _this.params = $('#query_form').serializeObject(_this.params);
            _this.querySearch(_this.params);
        },500);
    });

}
